package com.wgzx.modbus.codec;

import com.wgzx.modbus.entity.ModbusReqFrame;
import com.wgzx.modbus.serialize.ModbusFrameSerialization;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;

public class ModbusEncoder extends MessageToByteEncoder<ModbusReqFrame> {

    @Override
    protected void encode(ChannelHandlerContext channelHandlerContext, ModbusReqFrame modbusReqFrame, ByteBuf buf) {
        ModbusFrameSerialization.INSTANCE.serialize(modbusReqFrame, buf);
    }
}
